package com.un.ebs.core.enums;

import lombok.Getter;

/**
 * @Author zc
 * @ClassName OperatorEnum
 * @Description
 * @Date 2021/1/20
 */
@Getter
public enum OperatorEnum implements IEnum{

    TYPE_NE("不等于", 1),
    TYPE_EQ("等于", 2),
    TYPE_GT("大于", 3),
    TYPE_GE("大于等于", 4),
    TYPE_LT("小于", 5),
    TYPE_LE("小于等于", 6),
    TYPE_LIKE("包含", 7),
    TYPE_NOT_LIKE("不包含", 8),
    TYPE_IN("存在", 9),
    TYPE_SI("区间", 10);

    private final String operatorName;
    private final Integer operatorCode;

    OperatorEnum(String operatorName, Integer operatorCode) {
        this.operatorName = operatorName;
        this.operatorCode = operatorCode;
    }

    public static OperatorEnum getEnumByCode(Integer operatorCode) {
        for (OperatorEnum operatorEnum : OperatorEnum.values()) {
            if (operatorCode.equals(operatorEnum.getOperatorCode())) {
                return operatorEnum;
            }
        }
        return null;
    }

    @Override
    public int getCode() {
        return operatorCode;
    }

    @Override
    public String getDesc() {
        return operatorName;
    }
}
